You are here: Trading System Programming > Reference > Classes > TechnicalAnalysis > TechnicalAnalysis Methods > STOCHRSI

STOCHRSI

This method calculates the Stochastic Relative Strength Index.

 

Syntax

var STOCHRSI(period, fastKPeriod, fastDPeriod, maType, dataArray, calculatedFastKArray, calculatedFastDArray);

Parameters

period

Period integer value.

 

fastKPeriod

Fast K period integer value.

 

fastDPeriod

Fast D period integer value.

 

maType

One of the Moving Average constants.

 

dataArray

Array object filled with any data which will be used as the source for calculation.

 

calculatedFastKArray

Empty Array object that will be filled with fast K calculated data.

 

calculatedFastDArray

Empty Array object that will be filled with fast D calculated data.

Return Value

Returns true if calculation was completed successfully, or false otherwise.

Example

The following example demonstrates how to use STOCHRSI method.

 

function calculate(beginIndex, endIndex)

{

var period = 20;

var fastKPeriod = 15;

var fastDPeriod = 5;

var maType = TechnicalAnalysis.MA_EMA;

 

var dataArray = new Array();

 

//populate data array..

..

 

var calculatedFastKArray = new Array();

var calculatedFastDArray = new Array();

 

var rc = TechnicalAnalysis.STOCHRSI(period, fastKPeriod, fastDPeriod, maType, dataArray,

calculatedFastKArray, calculatedFastDArray);

}

 

 


Copyright © 2006-2009 ActiveTick LLC